<?php
class Zendvn_View_Helper_CmsUrl extends Zend_View_Helper_Url{
	
	public function cmsUrl($urlOptions = array(), $route = null, $map = array(), $reset = false, $encode = true){
		$front = Zend_Controller_Front::getInstance();
		$request = $front->getRequest();
				
		$router = $front->getRouter();		
		
		if($router->hasRoute($route) && ROUTE == true){
			return $this->url($urlOptions, $route, $reset, $encode);
		}else{
			if(!isset($urlOptions['module'])) $urlOptions['module'] = $request->getModuleName();
			if(!isset($urlOptions['controller'])) $urlOptions['controller'] = $request->getControllerName();
			if(!isset($urlOptions['action'])) $urlOptions['action'] = $request->getActionName();
			
			return $this->url($urlOptions,'default',true);
		}
	}
}